import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

type Result = {
  status: number;
  msg: string;
  success: boolean;
};

type KeyValue = {
  key: string;
  value: string;
};

type ResultKeyValue = {
  success: boolean;
  data?: Array<KeyValue>;
};

type ResultGroup = {
  success: boolean;
  data?: {
    list: Array<any>;
    totalCount: number;
  };
  msg?: string;
};

export const GetAllDelegateTeamByClassId = (params: string) => {
  return http.request<ResultKeyValue>(
    "get",
    baseUrlApi("/DelegateTeam/GetAllDelegateTeamByClassId?classId=" + params),
    {
      params
    }
  );
};

//分页查询
export const DelegateTeamGetPage = (params?: object) => {
  return http.request<ResultGroup>("get", baseUrlApi("/DelegateTeam/GetPage"), {
    params
  });
};

//删除
export const DelegateTeamDelete = (params?: object) => {
  return http.request<Result>("post", baseUrlApi("/DelegateTeam/Delete"), {
    params
  });
};

//保存
export const DelegateTeamSave = (data?: object) => {
  return http.request<Result>("post", baseUrlApi("/DelegateTeam/Save"), {
    data
  });
};
